package cn.yoyo.controller.fore;

import cn.yoyo.tools.RespJson;
import cn.yoyo.service.BookService;
import cn.yoyo.service.HotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class HomepageController {
    @Autowired
    BookService bookService;
    @Autowired
    HotService hotService;

    @RequestMapping("/api/public/hot/findAll")
    public Map<String, Object> findAll() {
        return RespJson.pack(200, "", hotService.findAll());
    }

    @RequestMapping("/api/public/book/findRate5")
    public Map<String, Object> findRate5() {
        return RespJson.pack(200, "", bookService.findRate5());
    }

    @RequestMapping("/api/public/book/findSale5")
    public Map<String, Object> findSale5() {
        return RespJson.pack(200, "", bookService.findSale5());
    }

    @RequestMapping("/api/public/book/findFav5")
    public Map<String, Object> findFav5() {
        return RespJson.pack(200, "", bookService.findFav5());
    }

}
